#!/bin/bash
# 多发行版 Docker 测试

set -e

TEST_CMD="pytest tests/ -v"
IMAGES=(
    "ubuntu:22.04"
    "debian:bullseye"
    "fedora:38"
    "archlinux:latest"
)

for image in "${IMAGES[@]}"; do
    echo "========== 测试镜像: $image =========="
    docker run --rm -v "$(pwd):/app" -w /app "$image" \
        bash -c "apt-get update && apt-get install -y python3-pip || dnf install -y python3-pip || true
                  pip install -r requirements.txt && $TEST_CMD"
done